﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HelloLLLLL.Blog.Models;
using HelloLLLLL.Blog.DAL;


namespace HelloLLLLL.Blog.Admin.page.table
{
    public partial class ArticleOp : System.Web.UI.Page
    {
       public List<LLType> ListType;
        public List<int> ListSelectType = null;
        DBHelper helper = new DBHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = string.IsNullOrEmpty(Request["Id"]) ? -1 : int.Parse(Request["Id"]);
            ListType = new ModelHandler<LLType>().FillModel(helper.GetDataTable("select * from LLArtType", null));
            if (id > 0) {
                ListSelectType = new List<int>();
                string sql = "select TypeId from ArtiAndType where [ArtId]=" + id;
                var dt = helper.GetDataTable(sql, null);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ListSelectType.Add(Convert.ToInt32(dt.Rows[i][0])); 
                }
        } }
    }
}